import json
import urllib.request
start=0
url = f'https://movie.douban.com/j/chart/top_list?type=25&interval_id=100%3A90&action=&start={start}&limit=20'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
                  '(KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0'
}

for i in range(10):
    start = i * 20
    request = urllib.request.Request(url, headers=headers)
    response = urllib.request.urlopen(request).read().decode('utf-8')
    loads = json.loads(response)
    print(loads)
    with open(f'{i+1}.json', 'w', encoding='utf-8') as f:
        f.write(json.dumps(loads, ensure_ascii=False))